<?php
/**
 * Each engineer has a duty to keep the code elegant
 * Created by wolffy.
 * Author @wolffy<13750088090@sina.cn>
 * Date: 2018/12/19
 * Time: 21:47
 */
namespace App\Http\Controllers\BackendApi;

use App\Http\Requests\BackendApi\GalleryRequest;
use App\Services\BackendApi\GalleryService;
use Illuminate\Http\Request;

class GalleryController extends ApiController
{
    protected $galleryService;

    public function __construct(GalleryService $galleryService)
    {
        $this->galleryService = $galleryService;
    }

    public function getList(Request $request)
    {
        return $this->galleryService->getList($request);
    }

    public function create(GalleryRequest $galleryRequest)
    {
        return $this->galleryService->create($galleryRequest->except('app_id', 'sign'));
    }

    public function edit(Request $request)
    {
        return $this->galleryService->edit($request->id);
    }

    public function update(GalleryRequest $galleryRequest)
    {
        return $this->galleryService->update($galleryRequest->id, $galleryRequest->except('app_id', 'sign', 'id'));
    }

    public function delete(Request $request)
    {
        return $this->galleryService->delete($request->id);
    }
}